
<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;

$this->title = '我的订单';
$this->params['breadcrumbs'][] = $this->title;
?>

<?= yii\web\View::registerCssFile("/css/front/order.css",['depends' => 'app\assets\MuiAsset']) ?>

<style type="text/css">
	#search{padding: 0;float: none;}
	/*.mui-table-view-cell:after{background-color: transparent;}*/
	/*.mui-table-view-cell>a:not(.mui-btn).mui-active{background-color:transparent;}*/
	.tips{padding: 40px 0 40px 0;} 
	.right{float: right;}
	.col-1{color: #F7BC08;}
	.col-2{color: #F7BC08;}
	.col-3{color: #FD5F20;} 
	.col-10{color: #666666;}
	.col-red{color: #FF6600;}
	.col-blue{color: #337ab7}
	.list-line:after {
		position: absolute;
		right: 0;
		bottom: 0;
		top: -8px;
		left: 0;
		height: 100%;
		width: 1px;
		content: '';
		-webkit-transform: scaleY(1);
		transform: scaleY(1);
		background-color: #c8c7cc;
	}
	#code{font-size: 14px;}
	.mui-segmented-control{border:1px solid #a664a6}
	.mui-segmented-control .mui-control-item{color: #a664a6;border-color: #a664a6;border-left: 1px solid #a664a6}
	.mui-segmented-control .mui-control-item.mui-active{background-color: #a664a6;}
	.line-order{margin-bottom: 10px;border: 1px solid #a664a6;color: #666;padding: 5px;border-radius: 3px;}
	.line-order span{font-size: 14px;}
	.line-order.order-active span{color: #FFFFFF !important;}
	.line-order.order-active{background-color: #a664a6;color: #FFFFFF;}
	.line-order.order-active .mui-badge{background-color: #FFFFFF;color: #ea0303 !important;}
	.line-btn{border: 1px solid #a664a6;color: #FFFFFF;background-color: #a664a6;}
	.panel-box{background-color: #FFFFFF;margin-top: 15px;}
	.list{margin: 15px;}

	.relation{background-color: #fdefb1;margin-bottom: 2px;}

	.text-center{text-align: center;}
	.mui-pagination>li>a, .mui-pagination>li>span{color: #a664a6;}
    .mui-pagination>li.mui-active>a, .mui-pagination>li.mui-active>a:active, .mui-pagination>li.mui-active>span, .mui-pagination>li.mui-active>span:active, .mui-pagination>li:active>a, .mui-pagination>li:active>a:active, .mui-pagination>li:active>span, .mui-pagination>li:active>span:active{border-color: #a664a6;background-color: #a664a6;}	
</style>
<nav class="mui-bar mui-bar-tab" style="background-color: #a664a6;">
	 <a id="lines" class="mui-tab-item" style="color: #FFFFFF;">选择船期订单</a>
</nav>
	<div class="header">
		
		<div class="h-info">
			<div class="logo">
				<img src="/img/logo.jpg"/>
			</div>
			<div class="h-zh">
				<p>账号：</p>
				<p><?=\Yii::$app->user->identity->username?></p>
			</div>
			<div class="h-tc">
				<a href="/member/member/logout" data-link="as" class="mui-btn">退出</a>
				<br>
				<?php if(empty($profile->openId)){ ?>
					<a href="/member/member/weixin" data-link="as" class="mui-btn mui-btn-primary">绑定微信号</a>
				<?php }else{?>
					 <a class="mui-btn mui-disable">已绑微信号</a>
				<?php }?>
				
			</div>
			
		</div>
	</div>
	<div class="mui-content">
		<?php if(!empty($order)){ ?>
				<?php foreach($order as $v){ ?>
					<div class="mui-card <?= ($v->isRelation > 1) ? 'relation' : '' ?>">
						<div class="mui-card-content">
							<a data-link="as" href="/member/member/order-info?id=<?=$v->id?>">
							<div class="mui-row list"><span style="color: #333;"><?=$v->product->name?></span></div>
							<div class="mui-row list">
								<div class="mui-col-xs-8">
									<span style="color: #333;">
									<?=sprintf("出发时间：%s",date("Y-m-d",strtotime($v->product->go_time)))?>
									</span>
								</div>
								<div class="mui-col-xs-4">
									<span class="jine col-red"><?=sprintf("￥%s",floor($v->price))?></span>
								</div>
							</div>
							<div class="mui-row list">
								<div class="mui-col-xs-8">
									<span style="color: #333;">
									<?php if(!empty($v->username) && !empty($v->phone)){
											 $str = '/';
										}else{
											 $str = '';	
										};
									?>
										<?=sprintf("%s%s%s",$v->username,$str,$v->phone)?>
									</span>
								</div>
								<div class="mui-col-xs-4">
									<span class="jine" style="color: #333;"><?=yii::$app->params['order_status'][$v->status]?></span>
								</div>
							</div>
							<div class="mui-row list">
								<div class="mui-col-xs-8">
									<span class="col-blue">
									<?php if($v->is_merge == 2){ ?>
										<i class="iconfont" <?= empty($v->merge_id) ? '' : "style=color:red;" ?> >&#xe6c2;</i>
									<?php } ?>
									</span>
								</div>
								<div class="mui-col-xs-4">
									<span class="jine col-blue">
										<?= ($v->isRelation > 1) ? '<i class="iconfont">&#xe6c0;</i>' : '' ?>
									</span>
								</div>
							</div>
							</a>
						</div>
						<div class="mui-card-footer">
							<a href="/member/member/order-detail?id=<?=$v->id?>" data-link="as" class="mui-btn line-btn" >上传资料</a>
							<?php if(\Yii::$app->user->can('room_stock')){	?>
							<a href="/front/default/line-room?id=<?=$v->product_id?>" data-link="as" class="mui-btn mui-pull-right line-btn">查看库存</a>
						<?php }?>	
						</div>
					</div>
					<?php if($v->nextIsRelation == 1){ ?>
					<div class="mui-row" style="background-color: #FFFFFF;height:10px;">
					</div>
					<?php }?>
				<?php }?>
		<?php }else{?>
				<div class="panel-box panel-box-cell tips">
					<p style="color: #333;text-align: center;"><?=$msg?></p>
				</div>	
		<?php }?>	

		<div class="mui-content-padded text-center">
                  
             <?= yii\widgets\LinkPager::widget(['pagination' => $pages,'lastPageLabel'=>false, 'firstPageLabel'=>false,'maxButtonCount'=>5,'activePageCssClass'=>'mui-active','disabledPageCssClass'=>'mui-disabled','nextPageLabel' => false,
'prevPageLabel' => false,'linkOptions'=>['data-link'=>'as'],'options'=>['class'=>'mui-pagination']]); ?>
        </div>


		<div id="modal" class="mui-modal">
		    <header class="mui-bar mui-bar-nav" style="background-color: #a664a6">
		        <a class="mui-icon mui-icon-close mui-pull-right" href="#modal" style="color: #FFF"></a>
		        <h1 class="mui-title" style="color: #FFF">选择船期订单</h1>
		    </header>
    
    	<form id="form1" action="<?=Yii::$app->request->getUrl();?>" method="get">	
			
			<input type="hidden" value="<?=$product_id?>" name="product_id" id="product_id"/>
		</form>

    	<div class="mui-content" style="background: #FFF;margin-top: 50px;height: 100%;">
        <div id="scroll" class="mui-scroll-wrapper" style="margin-top: 50px;">
          <div class="mui-scroll">
          		
                <div style="padding: 10px 10px;">
                	<?php if(!empty($all_num)){?>
                	<div class="line-order mui-row <?=($product_id == 0)?'order-active':''?>" data-id="0">
						<span>所有船期订单</span>
						<span class="mui-badge mui-badge-danger mui-pull-right"><?=$all_num?></span>				
					</div>
					<?php }?>
                    <div id="segmentedControl" class="mui-segmented-control">
						<a class="mui-control-item mui-active" href="#item1">在售</a>
						<a class="mui-control-item" href="#item2">过期</a>
					</div>
				</div>
				<div style="padding: 10px 10px;">
						<div id="item1" class="mui-control-content mui-active">
							<?php yii\widgets\Pjax::begin(['id'=>'SeaRoom','linkSelector'=>'a[data-sea]','timeout'=> 30000]); ?>
							<?php if(!empty($sellOrder)){?>
								<?php foreach($sellOrder as $val){ ?>
							<div class="line-order mui-row <?=($product_id == $val['product_id'])?'order-active':''?>" data-id="<?=$val['product_id']?>">
								<span style="color: #000;"><?=sprintf("出发日期：%s",$val['go_time'])?></span>
								<span class="mui-badge mui-badge-danger mui-pull-right"><?=$val['num']?></span>
								<span class="mui-block" style="color: #666"><?=$val['name']?></span>
								
							</div>
								<?php }?>
							<?php }else{?>
								<div class="line-order mui-row" style="text-align: center;">
									<span style="color: #000;">暂无在售船期订单</span>
								</div>
							<?php }?>
							<div class="mui-content-padded text-center">
							<?= yii\widgets\LinkPager::widget(['pagination' => $provider2->pagination,'lastPageLabel'=>false, 'firstPageLabel'=>false,'maxButtonCount'=>5,'activePageCssClass'=>'mui-active','disabledPageCssClass'=>'mui-disabled','nextPageLabel' => false,
								'prevPageLabel' => false,'linkOptions'=>['data-sea'=>'s1'],'options'=>['class'=>'mui-pagination']]); ?>
							<?php yii\widgets\Pjax::end([]); ?>	
							</div>	
						</div>

						<div id="item2" class="mui-control-content">
							<?php yii\widgets\Pjax::begin(['id'=>'InRoom','linkSelector'=>'a[data-in]','timeout'=> 30000]); ?>
							<?php if(!empty($overOrder)){?>
								<?php foreach($overOrder as $val){ ?>
							<div class="line-order mui-row <?=($product_id == $val['product_id'])?'order-active':''?>" data-id="<?=$val['product_id']?>">
								
								<span style="color: #000;"><?=sprintf("出发日期：%s",$val['go_time'])?></span>
								<span class="mui-badge mui-badge-danger mui-pull-right"><?=$val['num']?></span>
								<span class="mui-block" style="color: #666"><?=$val['name']?></span>
								
							</div>
								<?php }?>
							<?php }else{?>
								<div class="line-order mui-row" style="text-align: center;">
									<span style="color: #000;">暂无过期船期订单</span>
								</div>
							<?php }?>
							<div class="mui-content-padded text-center">
							<?= yii\widgets\LinkPager::widget(['pagination' => $provider->pagination,'lastPageLabel'=>false, 'firstPageLabel'=>false,'maxButtonCount'=>5,'activePageCssClass'=>'mui-active','disabledPageCssClass'=>'mui-disabled','nextPageLabel' => false,
								'prevPageLabel' => false,'linkOptions'=>['data-in'=>'s1'],'options'=>['class'=>'mui-pagination']]); ?>
							<?php yii\widgets\Pjax::end([]); ?>	
							</div>
						</div>

                </div>

           </div> 
        </div>
       
    </div>


	</div>

	</div>




<?php app\components\JsBlock::begin() ?>
<script type="text/javascript">
 mui.init({});
 mui('body').on('tap','#search',function(){
 	var code = $("#code").val();
 	document.getElementById('form2').submit();
 });
 

mui('body').on('tap',"#lines",function(){
    document.getElementById("modal").classList.add('mui-active');
    mui('#scroll').scroll({indicators: false});
});


mui('body').on('tap','.line-order',function(){
	
	$('.line-order').each(function(){
		 $(this).removeClass('order-active');
	});

	$(this).addClass('order-active');
	var product_id = $(this).attr('data-id');
	$("#product_id").val(product_id);
	document.getElementById("modal").classList.remove('mui-active');
	document.getElementById('form1').submit();

});


 mui('body').on('tap','a[data-link="as"]',function(){document.location.href=this.href;return false});

 mui('body').on('tap','a[data-in="s1"],a[data-sea="s1"],a[data-bal="s1"],a[data-sui="s1"],a[data-high="s1"],a[data-other="s1"]',function(){
   jQuery(this).trigger("click");
});
</script>
<?php app\components\JsBlock::end() ?>
